﻿using System.Windows;
using System.Windows.Controls;

namespace Poet.Views
{
    /// <summary>
    /// Interaction logic for GoToView.xaml
    /// </summary>
    public partial class GoToLineView
    {
        public GoToLineView()
        {
            InitializeComponent();
            Topmost = Application.Current.MainWindow.Topmost;
            Owner = Application.Current.MainWindow;
            Loaded += (o, e) =>
                {
                    LineNumberTextBox.Focus();
                    LineNumberTextBox.SelectAll();
                };
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            Close();
        }

        private void LineNumberTextBox_OnTextChanged(object sender, TextChangedEventArgs e)
        {
            OkButton.IsEnabled = !Validation.GetHasError(LineNumberTextBox);
        }
    }
}
